<template>
  <view>
    <uni-notice-bar color="#888" background-color="#f0f9eb" text="您即将进行法定代表人身份认证，为确保数据安全，请根据要求完成操作。"/>
    <uni-forms v-if="companyLegalChangeRecord!=null" labelWidth="140rpx"
               class="company-form">
      <uni-forms-item label="企业名称">
        <uni-easyinput v-model="companyLegalChangeRecord.companyName" disabled/>
      </uni-forms-item>
      <uni-forms-item label="法人姓名">
        <uni-easyinput v-model="companyLegalChangeRecord.name" disabled/>
      </uni-forms-item>
      <uni-forms-item label="身份证号">
        <uni-easyinput v-model="companyLegalChangeRecord.idNumber" disabled/>
      </uni-forms-item>
      <uni-forms-item label="手机号码">
        <uni-easyinput v-model="companyLegalChangeRecord.mobile" disabled/>
      </uni-forms-item>
      <view class="warning-p">
        <span><i class="iconfont"
                 style="padding-right: 10rpx;font-size: 24rpx;">&#xe70f;</i>1、点击“立即认证”按钮，系统将进行人脸识别核验。</span>
        <p style="margin-top:12rpx;margin-left:36rpx;">2、核验通过后，系统将通过国家工商系统再次验证法人身份信息。</p>
      </view>
    </uni-forms>
    <view class="footer-btn">
      <button @click="cancel" size="mini" class="cancel_btn">取 消</button>
      <button @click="submitLegalChange" size="mini" class="confirm_btn">立即认证</button>
    </view>
  </view>
</template>

<script>
import {DecryptCommon} from "../../../api/login";

export default {
  data() {
    return {
      companyLegalChangeRecord: '',
      data: null,// 密文
    }
  },
  onLoad(option) {
    this.data = option.data
    this.$modal.loading("加载中，请稍候...");
    DecryptCommon(option.data).then(response => {
      this.$modal.closeLoading()
      this.companyLegalChangeRecord = response
    });
  },
  methods: {
    /** 立即认证 */
    submitLegalChange() {
      this.$store.dispatch('LogOut').then(res => {
        // 先跳转到登录页 登录完成 跳转到 人脸页面
        this.$tab.reLaunch('/pages/login?verifyType=' + this.data + "&mobile=" + this.companyLegalChangeRecord.mobile+"&companyId=" + this.companyLegalChangeRecord.companyId)
      });
    },
    cancel() {
      uni.navigateBack(1)
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .uni-easyinput__content-input {
  color: #666;
}

page {
  background: $uni-bg-color;
}

.company-form {
  padding: 20rpx 30rpx;
}

.warning-p {
  color: #666;
  font-size: 24rpx;
}

.footer-btn {
  margin-top: 180rpx;
  width: 100%;
  text-align: center;

  .confirm_btn {
    margin-left: 50rpx;
    width: 40%;
    background-color: $uni-color-primary;
    color: #fff;
    display: inline-block;
    height: 70rpx;
    line-height: 70rpx;
  }
}

.cancel_btn {
  background-color: #fff;
  color: $uni-color-primary;
  width: 40%;
  display: inline-block;
  height: 70rpx;
  line-height: 70rpx;
  border: 1rpx solid $uni-color-primary;
}
</style>
